<template>
  <div class="singerdetail">
    <div class="singer-conent">
      <div class="singer-top">
        <div class="singer-name">{{singer.artist.name}}</div>
        <div class="E-name">ZHOUJIELIUN</div>
      </div>
      <div class="singer-item">
        <div class="img">
          <img :src="singer.artist.cover" alt="" />
          <div class="collect" @click="handleCollect(singer.artist)">{{collect}}</div>
        </div>
        <div class="link">
          <div>
            <router-link to="/singerdetail/hotworks">热门作品</router-link>
          </div>
          <div>
            <router-link :to="id">相关MV</router-link>
          </div>
          <div>
            <router-link :to="ids">艺人介绍</router-link>
          </div>
        </div>
        <keep-alive>
          <router-view></router-view>
        </keep-alive>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      singer: [],
      collect:"关注"
    };
  },
  computed: {
    id() {
      var { id } = this.$route.query;
      return `/singerdetail/relevantmv?id=${id}`;
    },
    ids() {
      var { id } = this.$route.query;
      return `/singerdetail/artist?id=${id}`;
    },
  },
  mounted() {
    var { id } = this.$route.query;
    this.$http.get(`/artist/detail?id=${id}`).then((res) => {
      this.singer = res.data.data;
    });
  },
  methods:{
    handleCollect(item){
      console.log(item);
      this.$https.post('/singer',{item}).then(res=>{
        console.log(res);
        this.collect = res.data.msg
      })
    }
  }
};
</script>

<style scoped>
.singerdetail {
  width: 1200px;
  margin: 0 auto;
  /* margin-top: 30px; */
}
.singer-conent {
  width: 800px;
  padding: 30px 80px;
}
.singer-top {
  display: flex;
}
.singer-name {
  font-size: 24px;
}
.E-name {
  margin-top: 9px;
  margin-left: 10px;
  color: #999999;
}
.singer-item {
  margin-top: 10px;
}
.img {
  position: relative;
  width: 800px;
  height: 450px;
  background-color: skyblue;
}
.collect {
  position: absolute;
  right: 60px;
  bottom: 30px;
  padding: 10px 10px;
  background: #abc4ff;
  color: #fff;
  border: 1px solid #333;
}
.img img {
  width: 800px;
  height: 450px;
}
.link {
  display: flex;
  line-height: 40px;
}
.link > div {
  margin-right: 30px;
}
</style>